package com.kunpeng.weibo.sina;

import com.kunpeng.weibo.sina.api.Authorize_API;
import com.kunpeng.weibo.sina.api.Friendships_API;
import com.kunpeng.weibo.sina.api.Statuses_API;
import com.kunpeng.weibo.sina.beans.Oauth2AccessToken;

/**
 * 新浪微博
 * 
 * @author Lee
 * @date 2012-4-20
 * @Description
 */
public class SinaWeibo {
	public static String				SINA_APP_KEY;			//"646600604";
	public static String				SINA_APP_SECRET;		//"0a0caaeec00323c5ebe4544be188cc9e";
	public static String				REDIRECT_URI_CALLBACK;	//"http://baobeitingting.jsp";

	private static SinaWeibo			mSinaWeibo;
	private static Oauth2AccessToken	mAccessToken;

	private SinaWeibo() {

	}

	public synchronized static SinaWeibo getInstance() {
		if (mSinaWeibo == null) {
			mSinaWeibo = new SinaWeibo();
		}
		return mSinaWeibo;
	}

	public void init(String appKey, String appSecret, String callBack) {
		SINA_APP_KEY = appKey;
		SINA_APP_SECRET = appSecret;
		REDIRECT_URI_CALLBACK = callBack;
	}

	public void setAccessToken(Oauth2AccessToken accessToken) {
		mAccessToken = accessToken;
	}

	/**
	 * 获取认证接口
	 * 
	 * @return
	 */
	public Authorize_API newAuthorize_API() {
		return new Authorize_API();
	}

	/**
	 * 获取微博接口
	 * 
	 * @return
	 */
	public Statuses_API newStatuses_API() {
		return new Statuses_API(mAccessToken);
	}

	/**
	 * 获取关系接口
	 * 
	 * @return
	 */
	public Friendships_API newFriendships_API() {
		return new Friendships_API(mAccessToken);
	}

}
